// /import core
// /commands 快捷键
// 配置快捷键
baidu.editor.plugins['shortcutkeys'] = function() {
	var editor = this, shortcutkeys = baidu.editor.utils.extend({
		"ctrl+66" : "Bold" // ^B
		,
		"ctrl+90" : "Undo" // undo
		,
		"ctrl+89" : "Redo" // redo
		,
		"ctrl+73" : "Italic" // ^I
		,
		"ctrl+85" : "Underline:Underline" // ^U
		,
		"ctrl+shift+67" : "removeformat" // 清除格式
		,
		"ctrl+shift+76" : "justify:left" // 居左
		,
		"ctrl+shift+82" : "justify:right" // 居右
		,
		"ctrl+65" : "selectAll"
			// ,"9" : "indent" //tab
		}, editor.options.shortcutkeys);
	editor.addListener('keydown', function(type, e) {

		var keyCode = e.keyCode || e.which, value;
		for (var i in shortcutkeys) {
			if (/^(ctrl)(\+shift)?\+(\d+)$/.test(i.toLowerCase())
					|| /^(\d+)$/.test(i)) {
				if (((RegExp.$1 == 'ctrl' ? (e.ctrlKey || e.metaKey) : 0)
						&& (RegExp.$2 != "" ? e[RegExp.$2.slice(1) + "Key"] : 1) && keyCode == RegExp.$3)
						|| keyCode == RegExp.$1) {

					value = shortcutkeys[i].split(':');
					editor.execCommand(value[0], value[1]);
					e.preventDefault
							? e.preventDefault()
							: (e.returnValue = false);

				}
			}
		}
	});

};